package view.listeners;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JMenuItem;

import model.Constants;
import view.dialogs.AddHostDialog;
import view.dialogs.AddSubnetDialog;
import view.dialogs.ChooseOptionDialog;
import view.dialogs.InfoDialog;
import controller.XmlManager;

public class MenuMouseListener extends MouseAdapter {


	@Override
	public void mousePressed(MouseEvent e) {
		JMenuItem item = (JMenuItem) e.getSource();

		if (item.getText().equalsIgnoreCase("Exit")) {
			System.exit(1);
		}

		if (item.getText().equalsIgnoreCase("Daten laden")) {
			XmlManager.getInstance().loadFromXML();			
		}
		if (item.getText().equalsIgnoreCase("Daten speichern")) {
			XmlManager.getInstance().saveToXML();
		}

		if (item.getText().equalsIgnoreCase("Neu")) {


		}
		if (item.getText().equalsIgnoreCase("Host-Adresse")){
			AddHostDialog addHostDialog = new AddHostDialog("Host hinzufügen");
		}
		if (item.getText().equalsIgnoreCase("Subnetz")){
			AddSubnetDialog addSubnetDialog = new AddSubnetDialog(
					"Subnetz hinzufügen");
		}
		if (item.getText().equalsIgnoreCase("IP-Adresse")){
			ChooseOptionDialog chooseDialog = new ChooseOptionDialog(
					"IP-Adresse hinzufügen");
		}
		if (item.getText().equalsIgnoreCase("Info")) {
			new InfoDialog(Constants.INFO,
					"Alex Müller, Jan Klecka , Patrick Grewe , Philipp Grulich");
		}

	}


}